package day018.homework.p1;

public class TicketTest implements Runnable {
    private int ticketNum = 100;

    @Override
    public void run() {
        while (true) {
            if (ticketNum <= 0) {
                break;
            } else {
                System.out.println(Thread.currentThread().getName() + " 售出了一张票" + " 还剩：" + --ticketNum + "张票");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
